<template>
</template>

<script>
</script>
	{
			async
			getUserList()
			{
				const { data: res } = await this.$http.get('users', {
					params: this.queryInfo
				})
				if (res.meta.status !== 200) {
					return this.$message.error('获取用户列表失败！')
				}
				this.userlist = res.data.users
				this.total = res.data.total
				// console.log(res)
			}
		,
			// 监听pagesize改变
			handleSizeChange(newSize)
			{
				this.queryInfo.pagesize = newSize
				this.getUserList()
				// console.log(newSize)
			}
		,
			//	监听页码值改变
			handleCurrentChange(newPage)
			{
				this.queryInfo.pagenum = newPage
				this.getUserList()
				// console.log(newPage)
			}
		,
			// 监听开关状态
			async
			userStateChanged(userinfo)
			{
				console.log(userinfo)
				const { data: res } = await this.$http.put(`users/${userinfo.id}/state/${userinfo.mg_state}`)
				if (res.meta.status !== 200) {
					userinfo.mg_state = !userinfo.mg_state
					return this.$message.error('更新用户失败')
				}
				this.$message.success('更新用户成功')
			}
		}
	}

<style>
</style>
